package flc.ast.fragment;

import android.os.Bundle;

import androidx.fragment.app.Fragment;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import flc.ast.R;
import flc.ast.activity.CameraActivity;
import flc.ast.activity.PhotoRecActivity;
import flc.ast.activity.SelPicActivity;
import flc.ast.activity.SpeechRecActivity;
import flc.ast.activity.SpeechTranslationActivity;
import flc.ast.databinding.FragmentToolBinding;
import stark.common.basic.base.BaseNoModelFragment;
import stark.common.basic.event.EventStatProxy;
import stark.common.basic.utils.StatusBarUtils;

/**
 * A simple {@link Fragment} subclass.
 * Use the {@link ToolFragment#newInstance} factory method to
 * create an instance of this fragment.
 */
public class ToolFragment extends BaseNoModelFragment<FragmentToolBinding> {


    @Override
    protected int onCreate() {
        return R.layout.fragment_tool;
    }

    @Override
    protected void initView() {
        StatusBarUtils.setSystemStatusTextColor(true, getActivity());
        EventStatProxy.getInstance().statEvent1(getActivity(), mDataBinding.event1Container);
        EventStatProxy.getInstance().statEvent5(getActivity(), mDataBinding.event5Container);

        mDataBinding.ivPhotoRec.setOnClickListener(this);
        mDataBinding.tvSpeechRec.setOnClickListener(this);
        mDataBinding.tvSpeechTrans.setOnClickListener(this);
        mDataBinding.tvPlantRec.setOnClickListener(this);
        mDataBinding.tvAnimalRec.setOnClickListener(this);
        mDataBinding.tvIdCardRec.setOnClickListener(this);
        mDataBinding.tvBankCardRec.setOnClickListener(this);
        mDataBinding.tvImageWatermarking.setOnClickListener(this);
    }

    @Override
    protected void onClickCallback(View v) {
        switch (v.getId()) {
            case R.id.ivPhotoRec://拍照翻译
                startActivity(PhotoRecActivity.class);
                break;
            case R.id.tvSpeechRec://语音识别
                startActivity(SpeechRecActivity.class);
                break;
            case R.id.tvSpeechTrans://语音翻译
                startActivity(SpeechTranslationActivity.class);
                break;
            case R.id.tvPlantRec://植物识别
                CameraActivity.type = 0;
                startActivity(CameraActivity.class);
                break;
            case R.id.tvAnimalRec://动物识别
                CameraActivity.type = 1;
                startActivity(CameraActivity.class);
                break;
            case R.id.tvIdCardRec://身份证识别
                CameraActivity.type = 2;
                startActivity(CameraActivity.class);
                break;
            case R.id.tvBankCardRec://银行卡识别
                CameraActivity.type = 3;
                startActivity(CameraActivity.class);
                break;
            case R.id.tvImageWatermarking://图片水印
                SelPicActivity.type = 2;
                startActivity(SelPicActivity.class);
                break;
        }
    }

    @Override
    protected void initData() {

    }
}